﻿A file importer and extractor for the two N64 Custom Robo titles.
  Allows injection and extraction of files, either individually or automated.
  Also has some handy built-in patches to aid translation nondestructively.

  Requires Python 3.4-ish or above.  Honestly, there's no good reason not to use the most recent version.
  Make sure your install includes tkinter and the ttk widgets too.
  If you're pulling C Python from python.org you should be good to go already.

  Pretty much the entirety of this readme can be viewed by selecting "Help/About" from the menubar.

Current Limits:
  Currently limitted to file replacement.
  Editting strings in the system files requires something outside this scope,
    like a hex editor, or applying patches.  That's mostly because those tables
    are fixed sizes and you're going to need to change pointers to the strings
    and/or data around them to fit.
  File formatting is predominantly left to outside tools, mosty because nobody
    likes the way I do that.  Script file commands differ between the titles,
    so current support here is limitted to their string tables.
  Sound file editting is best left to an outside utility, such as SubDrag's N64 Sound Tools.
  Didn't update this with newer versions of libraries (Patch(), LZSS()) to prevent breaking everything.
  At any rate, it's good enough to translate the game if you're into that kind of thing.

Usage:
  Run "CustomRobo.py".  Closing either window closes the whole thing.
    Menu window is the main interface; messages appear in the other one.

  Load a ROM using 'File/Open ROM'.
  If it is a supported title, a series of tabs will appear,
    several options on the menubar will become available,
    and applicable patches will be listed in the 'Patches' menu.
  Byteorder does not matter.  Both native and byteswapped files are supported.

  The tabs divide the different types of entries.
  Double left-click an entry in a tab to open a menu.
    'Import File' opens a dialog to replace the selected file with
      another binary file.  Compression is automatic when applicable.
      Altered files appear highlighted in green.
    The 'Script' tab provides an additional option: 'Update Script'.
      Given a text file of script entries, it will inject them into the
      current script and update all applicable file offsets.
    'Export File' opens a dialog to save the file.
  Double left-clicking a tab provides extracting all the tab's files
    to the current directory.  Use 'file/Change Directory' to modify the path.
    If 'Decompress Extracted Files' is set in 'Options',
    compressed files will be decompressed before output.
  To export all files in all tabs, use 'Tools/Export All' instead.

  Patches are applied when saving output.
  The 'Patches' menu allows toggling which patches will be applied.
    Pickled Patch() objects can be imported using 'Patches/Import'.
    Patches will only apply to the applicable game, so do not worry
    about deactivating or removing them.
  [Please note this thing uses an older version of the Patch() format,
   so be sure to use patches created from this particular object class!]

Batch Import:
  The tool is mostly designed to be run with batch operations.
  Use 'Tools/Create Build Script' to save a list of all modified files.
    Modified files appear in green.

  To import multiple files at once use 'Tools/Run Build Script'.
  Batch files are tab-delineated text files.  Only use tabs between entries.
  Commands:
    #   comment follows
    -b  slotname  filename
        [-b]        replace binary, compressing as needed
        [slot]      name of slot as it appears in the application
        [filename]  path to the file
    -r  slotname  filename
        [-r]        raw replacement, copied without any editting
        [slot]      name of slot as it appears in the application
        [filename]  path to the file
    -t  slotname  filename
        [-t]        update script with provided text entries
        [slot]      name of slot as it appears in the application
        [filename]  path to the file
    -p  slotname  filename
        [-p]        import png image (requires pypng!)
        [slot]      name of slot as it appears in the application
        [filename]  path to the file
        Note this type only functions with particular internal
          image types and requires an external library, pypng.
    chdir  dirpath
        [chdir]     sets working directory
        [dirpath]   path to directory
    import  pathname
        [import]    import pickled Patch() objects from binary file
        [filename]  path to the file
    apply  pathname
        [apply]    apply pickled Patch() objects in binary file
        [filename]  path to the file
        Note this does not save the patch to the 'Patches' list and disregards
          the 'default' flag on the patch.  It is also applied immediately;
          other patches are applied during the save process.

Saving Output:
  Select 'File/Save ROM' and provide a filename for the new ROM.
  Any selected patches and padding will be applied,
    and the checksum will be recalculated.
    All output files are in native (big-endian) format.

  When 'Tools/Pad Output ROMs' is set the output file is padded to
    the next 0x200000 boundry with zeroes.  This is highly suggested.
    (!) Be aware that "Custom Robo" has certain debug features mapped to
    the F00000 - F51000 range and failing to provide for this via
    either padding or outside support will cause potentially fatal errors!

Provided Patches:
  [Shared]
    ASCII Script Support
      Allows using single-byte ASCII values in script files.  All EUC values still function as well.
    ASCII Credits Support
      Allows using single-byte ASCII values in end credits.  Again, all EUC values still function.
    Font Colors Extension
      Increases available font color count from 8 to 12.  Original colors are retained.
      Colors are: black, blue, pink, purple, green, cyan, yellow, white, gray 50%, gray 25%, orange, red
    Debug Menus
      OFF by default.
      Forces the game to boot into the root debug menu, allowing easy access to the scenario and battle debuggers.
    USA Header
      OFF by default.
      Embeds timestamp and sets detected region to USA.
  [Custom Robo Only]
    CR Stages Extension
      Adds four additional single-player stages into the MP stage select menu.
    CR Cannonbot Select
      Allows selecting the cannonbot used in MP matches via holding combination of L & R on controller 1.
    CR Compilation Time for Debug Menus
      Places the compilation time into the header and displays that in the root debug menu.
      If debug in English, use AFTER that patch!

  There's a good chunk of commentary in the script in case you need to muck with it.
  Also, if you happen to want to look at all the text in a given scene in story mode,
    use the map jump feature, go to the Green Room, and talk to the upper-left most corner.  (0,11)
    That's an invisible trophy that will walk through all the dialog for you.

-Zoinkity
